package cn.anecansaitin.industrialization_expansion.client.event;

import cn.anecansaitin.industrialization_expansion.ExtensionLoader;
import cn.anecansaitin.industrialization_expansion.api.common.item.IToolModule;
import net.minecraft.client.renderer.color.ItemColors;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.ColorHandlerEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;

@Mod.EventBusSubscriber(value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD)
public class ItemColor {
    @SubscribeEvent
    public static void color(ColorHandlerEvent.Item event) {
        ItemColors itemColors = event.getItemColors();
        ExtensionLoader.MODULES.forEach(item -> itemColors.register((stack, index) -> ((IToolModule)item).getRenderColor(), item));
    }
}
